<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\admin\model;

class Company extends \app\BaseModel
{
    protected $name = "longbing_company";
    public function __construct()
    {
        parent::__construct();
    }
    public function createCompany($data)
    {
        $data["create_time"] = $this->time;
        return $this->createRow($data);
    }
    public function updateCompany($filter, $data)
    {
        $filter["deleted"] = 0;
        return $this->updateRow($filter, $data);
    }
    public function delCompany($filter)
    {
        $filter["deleted"] = 0;
        return $this->delRow($filter);
    }
    public function getCompany($filter)
    {
        $filter["company.deleted"] = 0;
        $company = $this->alias("company")->leftJoin("user user", "company.creator_id = user.user_id")->where($filter)->field(["company.*", "user.user_name as creator_name"])->find();
        return $company;
    }
    public function listCompany($filter, $page_config)
    {
        $filter["user.deleted"] = 0;
        $companys = $this->alias("company")->leftJoin("user user", "company.creator_id = user.user_id")->where($filter)->field(["company.*", "user.user_name as creator_name"])->page($page_config["page"], $page_config["page_count"])->select();
        return $companys;
    }
    public function listCompanyCount($filter)
    {
        $filter["user.deleted"] = 0;
        $count = $this->alias("company")->leftJoin("user user", "company.creator_id = user.user_id")->field(["company.company_id"])->where($filter)->count();
        return $count;
    }
}

?>